package cn.iocoder.yudao.module.dispatch.dal.mysql.runningstate;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dispatch.dal.dataobject.runningstate.RunningStateDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dispatch.controller.admin.runningstate.vo.*;

/**
 * 参数 Mapper
 *
 * @author 左达成
 */
@Mapper
public interface RunningStateMapper extends BaseMapperX<RunningStateDO> {

    default PageResult<RunningStateDO> selectPage(RunningStatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RunningStateDO>()
                .eqIfPresent(RunningStateDO::getRemark, reqVO.getRemark())
                .eqIfPresent(RunningStateDO::getValue, reqVO.getValue())
                .eqIfPresent(RunningStateDO::getLeiji, reqVO.getLeiji())
                .eqIfPresent(RunningStateDO::getInfo, reqVO.getInfo())
                .eqIfPresent(RunningStateDO::getOrd, reqVO.getOrd())
                .eqIfPresent(RunningStateDO::getRt, reqVO.getRt())
                .eqIfPresent(RunningStateDO::getRtm, reqVO.getRtm())
                .eqIfPresent(RunningStateDO::getSpm, reqVO.getSpm())
                .eqIfPresent(RunningStateDO::getType, reqVO.getType())
                .eqIfPresent(RunningStateDO::getPage, reqVO.getPage())
                .orderByDesc(RunningStateDO::getId));
    }

    default List<RunningStateDO> selectList(RunningStateExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<RunningStateDO>()
                .eqIfPresent(RunningStateDO::getRemark, reqVO.getRemark())
                .eqIfPresent(RunningStateDO::getValue, reqVO.getValue())
                .eqIfPresent(RunningStateDO::getLeiji, reqVO.getLeiji())
                .eqIfPresent(RunningStateDO::getInfo, reqVO.getInfo())
                .eqIfPresent(RunningStateDO::getOrd, reqVO.getOrd())
                .eqIfPresent(RunningStateDO::getRt, reqVO.getRt())
                .eqIfPresent(RunningStateDO::getRtm, reqVO.getRtm())
                .eqIfPresent(RunningStateDO::getSpm, reqVO.getSpm())
                .eqIfPresent(RunningStateDO::getType, reqVO.getType())
                .eqIfPresent(RunningStateDO::getPage, reqVO.getPage())
                .orderByDesc(RunningStateDO::getId));
    }

}
